package com.tanhua.common.utils;

import com.tanhua.common.pojo.Admin;


public class AdminThreadLocal {
    private static final ThreadLocal<Admin> LOCAL = new ThreadLocal<>();

    private AdminThreadLocal() {
    }

    /**
     * 把admin对象放到线程里面
     * @param admin
     */
    public static void set(Admin admin) {
        LOCAL.set(admin);
    }

    /**
     * 返回当前线程上绑定的User对象
     *
     * @return 绑定在线程伤上的User对象
     */
    public static Admin get() {
        return LOCAL.get();
    }

    /**
     * 删除当前线程上绑定的User对象
     */
    public static void remove() {
        LOCAL.remove();
    }
}
